package com.ihai.spring.boot.sample.file;

import java.io.*;

/**
 * @author Adolphus
 * @description TODO
 * @date 2021/9/30 17:21
 */
public class Application {
    public static void main(String[] args) throws Exception {
        File file = new File("D:\\hana\\log\\HXE\\mnt00001\\hdb00002.00003\\logsegment_000_00000009.dat");
        BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
        byte[] bytes = new byte[1024*1024];
        long count = 0;
        System.out.println("start..");
        int n = 0;
        in.skip(count);
        while((n = in.read(bytes)) > -1){
            count += n;
//            for(byte b : bytes){
//                System.out.print(b);
//            }
            int i = 0;
            for(byte b : bytes){
                if(b == bytes[0]){
                    i++;
                }
            }
            if(i == n){
//                break;
            }
            System.out.print(new String(bytes,0,n));
//            if(count >= 12362688){
//                break;
//            }
//            if(str.contains("201612")) {
//                System.out.println("201612:"+new String(bytes,0,n));
//            }
//            System.out.println(count);
        }
        System.out.println();
        System.out.println("stopped");
    }
}
